package com.jo.advisor;

import com.jo.interceptor.MethodInterceptor;
import com.jo.invocation.MethodInvocation;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 * 切面方法后的advise，直接实现了MethodInterceptor，就可以直接当做方法拦截器
 *
 * @author Jo
 * @date 2018/1/25
 */
@Slf4j
public class AspectAfterAdvice extends AbstractAdvice implements AfterAdvice, MethodInterceptor {
    public AspectAfterAdvice(Method adviceMethod, Object aspectAdviceObj) {
        super(adviceMethod, aspectAdviceObj);
    }

    @Override
    public Object invoke(MethodInvocation mi) throws Throwable {
        Object result = mi.proceed();
        log.info("开始after interceptor");
        invokeAdviceMethod();
        return result;
    }
}
